//
//  SVGCircle.m
//  Shake and Bake
//
//  Created by Antoine Quint on 12/08/07.
//  Copyright 2007 __MyCompanyName__. All rights reserved.
//

#import "SVGCircle.h"
#import "CoreServices/CoreServices.h"

@implementation SVGCircle

- (id)initWithAttributeDict:(NSDictionary *)attributesDict andView:(Canvas *)aView
{
  [super initWithAttributeDict:attributesDict andView:aView];
	if (self) {
		// parse attribute values
		cx = [[attributes objectForKey:@"cx"] floatValue];
		cy = [[attributes objectForKey:@"cy"] floatValue];
		r = [[attributes objectForKey:@"r"] floatValue];
		//
		self.position = CGPointMake(cx - r, cy - r); 
		self.bounds = CGRectMake(0.0f, 0.0f, r*2, r*2);
		self.name = @"circle";
	}
	return self;
}

- (void)makePath:(CGContextRef)context
{
	CGContextAddArc(context, r, r, r, 0, 2 * pi, 1);
}

@end
